package com.teemo.equipment.exception;

import com.teemo.equipment.enums.BizCodeEnum;
import lombok.Data;

/**
 * @author Teemo
 */
@Data
public class BizException extends RuntimeException{
    private Integer code;

    private String message;

    public static BizException of(Integer code, String message) {
        BizException bizException = new BizException();
        bizException.setCode(code);
        bizException.setMessage(message);
        return bizException;
    }

    public static BizException of(String message) {
        BizException bizException = new BizException();
        bizException.setCode(BizCodeEnum.UNKNOWN_ERROR.getCode());
        bizException.setMessage(message);
        return bizException;
    }
}
